package com.authine.cloudpivot.common.extension.defaultextension;

import com.alibaba.cola.dto.SingleResponse;
import com.alibaba.fastjson.JSON;
import com.authine.cloudpivot.common.extension.client.dto.AbstractMessageDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 消息服务扩展点默认扩展实现
 * <p>
 * 请勿修改任何类和方法的定义
 * <p>
 * 只需要在方法内部编写业务逻辑
 */
@Api(tags = "消息服务扩展点")
@Slf4j
@RestController
@RequestMapping("/message/v1")
public class MessageExtensionController {

    @ApiOperation(value = "发送消息")
    @ApiImplicitParam(name = "message", value = "消息对象对象")
    @PostMapping("/send_message")
    public SingleResponse<Boolean> sendMessage(@RequestBody AbstractMessageDTO message) {
        log.info("二开发送消息...{}", JSON.toJSONString(message));
        // TODO 编写二开代码
        return SingleResponse.of(Boolean.TRUE);
    }

}
